{ext->class_function class="shop" func="get_product_group_data" group=$smarty.get.group_id assign="group_data"}
{ext->class_function class="shop" func="get_product_group_data" group=$group_data.parent assign="group_data2"}
{ext->class_function class="import" func="get_import_header" assign="import_header" source=$smarty.get.sheet_number}
{ext->class_function class="import" func="get_import_source" assign="import_source"}
{ext->class_function class="shop" func="get_product_group_fields" group=$smarty.get.group_id assign="group_product_fields"}		
{ext->class_function class="import" func="get_result_by_sessionid" assign="report"}	
<script language="javascript1.4" type="text/javascript">
	var dataImport=new Object();
	dataImport.PDF=new Object();
	{literal}
	dataImport.setLangField=function(nID,oSelf){
		var sLang=oSelf.value;
		var oChild=document.getElementById('col_'+nID);
		
		fRemoveAllSelectOptions(oChild);
		for(i in this.PDF){
			if (typeof(this.PDF[i]['uni'])!='undefined'){				
				oChild.options[oChild.options.length]=new Option(this.PDF[i]['uni'],i, false, false);
			} else if (typeof(this.PDF[i][sLang])!='undefined') {
				oChild.options[oChild.options.length]=new Option(this.PDF[i][sLang],i, false, false);
			} else {
			
			}
			
		}
	}
	{/literal}	
	dataImport.PDF['-111']=new Object();
	dataImport.PDF['-111']['uni']='{t t='Nepasirinkta'}';
	{foreach from=$group_product_fields item="el2"}
		dataImport.PDF['{$el2.name}']=new Object();
		dataImport.PDF['{$el2.name}']['{$el2.lang|default:"uni"}']='{t t=$el2.name}';
	{/foreach}	
</script>	
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td height="10"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
			</tr>
			<tr>
				<td height="1" bgcolor="#ADB9BF"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			</tr>
			<tr>
				<td height="1" bgcolor="#E4E9EC"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			</tr>
			<tr>
				<td height="10"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
			</tr>
		</table>		
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td height="1" bgcolor="#C4CDD2"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
			</tr>			
		</table>
		<table width="100%" cellpadding="0" cellspacing="0" style="border:1px solid #C4CDD2; border-top:0px;">
			<tr>
				<td width="1" bgcolor="#DBE1E5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
				<td style="border:5px solid white; border-bottom:0px">
					<table width="100%" cellpadding="0" cellspacing="0">
					<tr>
						<td style="border:1px solid #8CA2B1">
										<!-- *  -->
										
										
										
										
										
										
										
										<table width="100%" cellpadding="0" cellspacing="0">
											<tr>
												<td bgcolor="#EDF0F2" style="padding:10px; line-height:150% ">
												<table width="100%" cellpadding="0" cellspacing="0">
													<tr>
														<td>{t t="Duomenys bus įterpti į"}: <strong>{$group_data2.name}</strong>/<strong>{$group_data.name}</strong> ({t t='tipas'}: <strong>{t t=$group_data.type}</strong>)</td>											
													</tr>
												</table>									
												</td>		
											</tr>
										</table>
							<!-- * kliento duomenys -->
							{if !$import_header}
										<table width="100%" cellpadding="0" cellspacing="0" style="border-top:1px solid #8CA2B1 ">
											<tr>
												<form action="index.php" enctype="multipart/form-data" method="post" name="importform11">
												<input name="admin" type="hidden" value="1">
												<input name="module" type="hidden" value="import">
												<input name="mod" type="hidden" value="load">
												<input name="act" type="hidden" value="step1">
												<input name="referer" type="hidden" value="{ext->get_referer}">

												<td style="padding:10px " bgcolor="#DBE1E5" width="1"><nobr>{t t="Nurodykite duomenų šaltinį"}: </td>	
												<td style="padding:10px"><input type="file" name="import_file" class="defaultInputText" accept="application/msexcel" style="width:100% "></td>	
												<td width="1" style="padding:10px"><nobr>{t t='Pasirinkite failo tipą'}:</td>
												<td style="padding:10px" width="1">
												<select name="type" style="width:200px ">
													{foreach from=$_var.import_type item="el" key="key"}
													<option value="{$key}">{$el}</option>
													{/foreach}
												</select>
												</td>
												<td style="padding:10px" width="1"><input type="submit" value="{t t='Įkrauti'}" class="defaultFormButton"></td>
												</form>
											</tr>
										</table>
							{/if}
										{if $import_header}
										<table cellpadding="0" cellspacing="0" style="border-top:1px solid #8CA2B1; " bgcolor="#ffffff" width="100%">
											<tr>
												<td height="25" style="padding:10px; " width="1"><nobr>{t t='Pasirinktas lapas'}:
												</td>	
												<td width="1" style="padding:10px; ">
												<select name="sheet_number" style="width:150px" id="sheet_number_select">
												{foreach from=$import_source item="el" key="key"}
												<option value="{$key}" {if $smarty.get.sheet_number==$key} selected {/if}>{$key}</option>
												{/foreach}
												</select>
												</td>	
												<td style="padding:10px; "><input type="button" value="{t t='Pasirinkti'}" class="defaultFormButton" onClick="doTheFiltering(document.getElementById('sheet_number_select'),'sheet_number')"></td>
											</tr>
										</table>
										
							<!-- /* kliento duomenys -->
							
							
							<!-- * Uzsakymo duomenys -->
										<!--<table width="100%" cellpadding="0" cellspacing="0" style="border-top:1px solid #8CA2B1 ">
											<tr>
												<td style="padding:10px " bgcolor="#DBE1E5"><strong>{t t="Duomenų žemėlapis"}</strong></td>		
											</tr>
										</table>			 -->							
										<table width="100%" cellpadding="0" cellspacing="0">
											<tr>
												<td bgcolor="#ffffff">
												<form action="index.php" enctype="multipart/form-data" method="post" name="importform">
													<input name="admin" type="hidden" value="1">
													<input name="module" type="hidden" value="import">
													<input name="mod" type="hidden" value="load">
													<input name="act" type="hidden" value="step2">
													<input name="to" type="hidden" value="shop">
													<input name="parent" type="hidden" value="{$smarty.get.group_id}">
													<input name="referer" type="hidden" value="{ext->get_referer}">
													<input name="source" type="hidden" value="{$import_header.0.source}">
													<input name="group_id" type="hidden" value="{$smarty.get.group_id}"> 
													
												
													<table width="100%" cellpadding="0" cellspacing="0">
														<tr>
															<td>																								
															{counter start=1 skip=1 assign="ct"}
															{foreach from=$data.tree.lang item="langs"}
															<table width="100%" cellpadding="0" cellspacing="0">
																<tr>
																	<td bgcolor="#8CA2B1"><img src="client/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>		
																</tr>
															</table>
															<table width="100%" cellpadding="0" cellspacing="0">
																<tr>
																	<td height="25" bgcolor="#EDF0F2" style="padding:0px 0px 0px 10px ">{t t='Kalba'}: <strong>{$langs.name}</strong></td>		
																</tr>
															</table>
															<table width="100%" cellpadding="0" cellspacing="0">
																<tr>
																	<td bgcolor="#8CA2B1"><img src="client/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>		
																</tr>
															</table>
															<table  cellpadding="0" cellspacing="0" style="margin:0px 10px 0px 10px ">																							
																<tr>
																	<td width="150" style="border-right:1px solid #EDF0F2 " height="25">
																	<strong>{t t='Įvedimo laukas sistemoje'}</strong>
																	</td>
																	<!--<td style="padding:3px 10px 3px 10px; border-right:1px solid #EDF0F2 " width="50">
																	<strong>{t t='Kalba'}</strong>
																	</td>-->
																	<td style="padding:3px 10px 3px 10px; border-right:1px solid #EDF0F2 " width="240">
																	<strong>{t t='Stulpelio pavadinimas'}</strong>
																	</td>
																	<td style="padding:3px 10px 3px 10px; border-right:1px solid #EDF0F2 " width="170">
																	<strong>{t t='Perrašymas'}</strong>
																	</td>																	
																</tr>																								
														</table>
														<table width="100%" cellpadding="0" cellspacing="0">
															<tr>
																<td bgcolor="#8CA2B1"><img src="client/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>		
															</tr>
														</table>
															{foreach from=$group_product_fields item="el2"}	
															{*debug var=$el2*}
															{if (($el2.lang==$langs.name) || (($_var.default_lang == $langs.name) && (!$el2.lang)))}
															<table  cellpadding="0" cellspacing="0" style="margin:0px 10px 0px 10px ">																							
																	<tr>
																		<td width="150" style="border-right:1px solid #EDF0F2 ">{t t=$el2.name}</td>																		
																		<td style="padding:3px 10px 3px 10px; border-right:1px solid #EDF0F2 " width="240">
																		<select name="{$langs.name}[{$el2.name}][col]" style="width:220px; ">
																			<option value="-111">{t t='Nepasirinkta'}</option>
																			{foreach from=$import_header item="el"}																			
																			<option value="{$el.col}">{$el.value}</option>																			
																			{/foreach}
																		</select>
																		</td>
																		<td style="padding:3px 10px 3px 10px; border-right:1px solid #EDF0F2 " width="170">
																		<select name="{$langs.name}[{$el2.name}][rewrite]" style="width:160px ">
																			<option value="notrewrite">{t t='Gali kartotis'}</option>
																			<option value="rewrite">{t t='Unikalus kategorijoje'}</option>
																			<option value="rewrite_global">{t t='Unikalus visoje parduotuvėje'}</option>
																		</select>
																		</td>																		
																	</tr>																								
															</table>
															<table width="100%" cellpadding="0" cellspacing="0">
																<tr>
																	<td bgcolor="#EDF0F2"><img src="client/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>		
																</tr>
															</table>
															{counter skip=1 assign="ct"}
															{/if}
															{/foreach}																	
															{/foreach}		
													</td>		
												</tr>
											</table>
											<table cellpadding="0" cellspacing="0" style="border-top:1px solid #8CA2B1; border-bottom:1px solid #8CA2B1 " bgcolor="#ffffff" width="100%">
												<tr>
													<td height="25" style="padding:10px; " width="1"><nobr>{t t='Radus dublikatą'}:
													</td>	
													<td width="1" style="padding:10px; ">
													<select name="dublicate_action" style="width:150px">
														<option value="overide">{t t='Rašyti ant viršaus'}</option>
														<option value="skip">{t t='Praleisti įrašą'}</option>
													</select>
													</td>	
													<td style="padding:10px; " width="1"><nobr>{t t='Pavadinimas'}</td>
													<td style="padding:10px; ">
													<select name="product_name" style="width:220px; ">
														{foreach from=$import_header item="el"}																			
														<option value="{$el.col}">{$el.value}</option>																			
														{/foreach}
													</select>
													</td>	
												</tr>
											</table>	
												<table  cellpadding="0" cellspacing="0">
													<tr>
														<td><input type="submit" value="{t t='Importuoti'}"  class="defaultFormButton" style="margin:10px "></td>
														<td><input type="button" value="{t t='Išvalyti'}"  class="defaultFormButton" style="margin:10px " onClick="document.forms['importform'].mod.value='reset'; document.forms['importform'].submit()"></td>		
													</tr>
												</table>
													</form>
												</td>		
											</tr>
										</table>
							<!-- /* uzsakymo duomenys -->				
							
							{/if}
<!-- * ataskaita -->

{if $report}
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td bgcolor="#8CA2B1"><img src="client/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>		
	</tr>
</table>
	{if $report.ok}	
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td height="25" bgcolor="#EDF0F2" style="padding:0px 0px 0px 10px ">{t t='Įterpta'} (<strong>{ext->countArray array=$report.ok}</strong>)</td>		
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="#8CA2B1"><img src="client/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>		
		</tr>
	</table>
	{foreach from=$report.ok item="el"}
		<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
			<tr>
				<td height="20" style="padding:0px 10px 0px 10px; border-bottom:1px solid #EDF0F2 ">
					{counter start=0 skip=1 assign="ct"}
					{foreach from=$el item="el2"}{if 5>$ct}{if $ct>0}, {else}{/if}{$el2|truncate:50}{counter skip=1 assign="ct"}{/if}{/foreach}.
				</td>		
			</tr>
		</table>
	{/foreach}
	{/if}
	{if $report.skip}
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td height="25" bgcolor="#EDF0F2" style="padding:0px 0px 0px 10px ">{t t='Praleista'} (<strong>{ext->countArray array=$report.skip}</strong>)</td>		
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="#8CA2B1"><img src="client/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>		
		</tr>
	</table>
	{foreach from=$report.skip item="el"}
		<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
			<tr>
				<td height="20" style="padding:0px 10px 0px 10px; border-bottom:1px solid #EDF0F2 ">
					{counter start=0 skip=1 assign="ct"}
					{foreach from=$el item="el2"}{if 5>$ct}{if $ct>0}, {else}{/if}{$el2|truncate:50}{counter skip=1 assign="ct"}{/if}{/foreach}.
				</td>		
			</tr>
		</table>
	{/foreach}
	{/if}
	{if $report.overide}
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td height="25" bgcolor="#EDF0F2" style="padding:0px 0px 0px 10px ">{t t='Perrašyta'} (<strong>{ext->countArray array=$report.overide}</strong>)</td>		
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="#8CA2B1"><img src="client/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>		
		</tr>
	</table>
	{foreach from=$report.overide item="el"}
		<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
			<tr>
				<td height="20" style="padding:0px 10px 0px 10px; border-bottom:1px solid #EDF0F2 ">
					{counter start=0 skip=1 assign="ct"}
					{foreach from=$el item="el2"}{if 5>$ct}{if $ct>0}, {else}{/if}{$el2|truncate:50}{counter skip=1 assign="ct"}{/if}{/foreach}.
				</td>		
			</tr>
		</table>
	{/foreach}
	{/if}
{/if}
{*debug var=$report*}
<!-- /* ataskaita -->
										
										
										<!-- /*  -->		
						</td>		
					</tr>
					</table>
				
				<table width="100%" cellpadding="0" cellspacing="0">
					<tr>
						<td bgcolor="#FFFFFF" height="5">						
						</td>		
					</tr>
				</table>
				</td>	
				<td width="1" bgcolor="#DBE1E5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			</tr>
		</table>


<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="1" bgcolor="#DBE1E5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="20"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>

{*debug var=$group_product_fields*}
{*debug var=$report*}

